/* #region  uiImports */

import BaseWindow from "../common/BaseWin";

/* #endregion uiImports */
export default class RankLayer extends fgui.GComponent {
  /* #region  uiVals */

//   m_contentTxt: fgui.GTextField;
  curScene: cc.Component;
 /* #endregion uiVals */

//   public static URL: string = "ui://073x7as5n8j022w";
  static bImmediatelyHide = false;
  m_tipDialog: BaseWindow;
  _confirmCB: Function;

  public static createInstance(): RankLayer {
    let inst = <RankLayer>fgui.UIPackage.createObject("IMGame", "RankDialog");
    fgui.GComponent.autoInit(inst);
    return inst;
  }

  /* #region  btnClick Events */

  onConfirmBtnClick() {
    if (this._confirmCB) {
      this._confirmCB();
      this._confirmCB = null;
    }
    this.closTips();
  }

  onCancelBtnClick() {
    this.closTips();
  }

  onBgCloseBtnClick() {
    this.closTips();
  }

  closTips() {
    if (RankLayer.bImmediatelyHide) this.m_tipDialog.hideImmediately();
    else this.m_tipDialog.hide();
  }

  /* #endregion btnClick Events */

  setContainer(container: BaseWindow) {
    this.m_tipDialog = container;
  }
}
